package com.cdz.controller;


import com.cdz.commen.R;
import com.cdz.form.InitBleForm;
import com.cdz.form.MessageForm;
import com.cdz.form.NpnForm;
import com.cdz.form.StatusForm;
import com.cdz.service.PileService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/cdz/pile")
public class PileController {

    @Resource
    private PileService pileService;

    @PostMapping("/analysisMessage")
    public R<?> analysisMessage(@RequestBody MessageForm messageForm)   {
        return pileService.analysisMessage(messageForm);
    }

    @GetMapping("/getStatus")
    public R<?> getStatus(@RequestParam String chargingPileId) {
        return pileService.getStatus(chargingPileId);
    }

    @PostMapping("/setPnpStatus")
    public R<?> setPnpStatus(@RequestBody NpnForm npnForm) {
        return pileService.setPnpStatus(npnForm);
    }

    @GetMapping("/getPNPStatus")
    public R<?> getPNPStatus(@RequestParam String chargingPileId) {
        return pileService.getPNPStatus(chargingPileId);
    }

    @GetMapping("/getPiles")
    public R<?> getPiles() {
        return pileService.getPiles();
    }

    @PostMapping("/insertPileInfo")
    public R<?> insertPileInfo(@RequestBody InitBleForm initBleForm ) {
        return pileService.insertPileInfo(initBleForm);
    }

    @PostMapping("/emptyData")
    public R<?> emptyData(@RequestBody InitBleForm initBleForm ) {
        return pileService.emptyData(initBleForm);
    }


}
